package com.easyj.task;

import java.util.Calendar;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.easyj.admin.sys.service.UserService;
import com.easyj.base.security.SecurityConstant;

@Service
public class UserLockTask {
	
	@Autowired
	private  UserService userService;
    /**
            *   把锁定用户超过24小时后自动解锁
     */
	@Scheduled(cron = "0 */10 * * * ?")////每2分钟都执行
    public void unLockUser(){
		Calendar calendar=Calendar.getInstance(); //now
		calendar.add( Calendar.HOUR_OF_DAY,0-SecurityConstant.LockHour);
		userService.unLockedUserAuto(calendar.getTime());
    }
}
